package 基础.this_;

class Date{
    public int year;
    public int month;
    public int day;

    public void setdate(int year,int month,int day){//错误就近原则
        year =year;
        month =month;
        day = day;
    }
    public void setdate1(int year1,int month1,int day1){//可以
        year =year1;
        month =month1;
        day = day1;
    }
    public void setdate2(int year,int month,int day){
        this.year =year;
        this.month =month;
        this.day = day;
        this.showdate();//调用方法
    }
    public void showdate(){
        System.out.println("年: "+this.year+" 月: "+this.month+" 日: "+this.day);
    }
}
public class this_ {
    public static void main(String[] args) {
        Date date = new Date();
        date.setdate2(2025,1,1);
    //    date.showdate();
    }
}
